home *** CD-ROM | disk | FTP | other *** search
- Path: fas-news.harvard.edu!mito!robison
- From: robison@mito.harvard.edu (Keith Robison)
- Newsgroups: comp.lang.c++,comp.lang.java
- Subject: Re: Java: What's the Big Deal?
- Followup-To: comp.lang.c++,comp.lang.java
- Date: 22 Mar 1996 14:50:27 GMT
- Organization: Harvard University, Cambridge, Massachusetts
- Message-ID: <4iuenj$ng2@decaxp.HARVARD.EDU>
- References: <milodDoF9JF.K32@netcom.com> <1996Mar20.154600.12011@amc.com>
- NNTP-Posting-Host: mito.harvard.edu
- X-Newsreader: TIN [version 1.2 PL2]
-
- Curtis Green (curtis@amc.com) wrote:
- : John DiCamillo (milod@netcom.com) wrote:
- : : pete@borland.com (Pete Becker) writes:
-
- : : >>2) No header files => faster compilation
- : :
- : : >Nonsense. Header files are simply text that gets included where you want it. If
- : : >you write the same code without header files it will not magically compile
- : : >faster.
- : :
- : : It's not nonsense. Cascaded #includes result in such a
- : : drastic inflation of the source text that it makes a measurable
- : : increase in compilation time.
- : If you surround your header file with #ifndef .. #endif you should be able
- : to eliminate your cascaded #include problem
- : foo.h
- : #ifndef FOO_H
- : #define FOO_H
- : ...
- : #endif
-
- I think what the author was referring to was not multiply-including
- a particular header file (which is generally a compile-time error),
- but the fact that each header includes other headers which include
- other headers (etc). This can indeed take a long time with a large
- header file collection, even if properly defended as above.
-
- What is far more evil is that your namespace depends on this
- rat's nest of includes, and that the actual pattern of includes
- depends on the includes. This is one feature I really like about
- Java -- you are required to explicitly set up your namespace, and
- therefore the namespace for a given compilation unit can be determined
- by the text in that source file; no identifiers sneaking in because
- they were included 10 levels back.
-
-
- Keith Robison
- Harvard University
- Department of Molecular & Cellular Biology
- Department of Genetics
-
- robison@mito.harvard.edu
-
-